<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Template.Master" Inherits="IWS.SiteManager.Web.Views.LayoutView<IWS.SiteManager.Core.Model.Section>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
	$().ready(function() {
		$("#CreatePage").click(function() {
			window.location = "../EditContent/";
		});
		$(".delete_page").click(function() {
			return confirm("Are you sure you want to delete this page?");
		});
	});
</script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="EndBodyContent" runat="server">
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
	<div class="breadcrumb">
		<%=Html.ActionLink("Administration", "Index", "Manage") %> -&gt; <%=Html.ActionLink("Sections", "Sections", "Manage") %> -&gt; <%=Model.ID%>
	</div>

	<h2>Section Details [<%=Model.ID %>]</h2>
	<p><%=Model.Description %></p>
	<input id="CreatePage" type="button" value="Create Page" />
	
	<%//show pages, if any exist
	if (Model.Pages != null && Model.Pages.Count > 0)
	{ %>
	<h3>Pages</h3>
	<table class="list width80">
		<tr>
			<th class="align-left width80">Title</th>
			<th>Author</th>
			<th>Tags</th>
			<th class="align-right">Date</th>
		</tr>
<%			for (int ix = 0; ix < Model.Pages.Count; ix++)
			{
				var page = Model.Pages[ix];
				var isDefault = Model.DefaultContentID == page.ID;
%>
		<tr<%=isDefault ? " class=\"default\"" : string.Empty %>>
			<td><span class="data-title"><%=page.Title%></span>
				<br /><a href="/View/<%=Model.ID %>/<%=page.Permalink %>">/View/<%=Model.ID %>/<%=page.Permalink %></a>
				<br /><span class="manage-links"><%=Html.ActionLink("Edit", "EditContent", new { id = page.ID })%><%=Html.ActionLink("Delete", "DeleteContent", new { id = page.ID }, new {@class="delete_page"})%></span>
			</td>
			<td><%=page.CreatedBy %></td>
			<td><%=page.Tags %></td>
			<td class="align-right">Modified: <%=page.ModifiedUTC%></td>
		</tr>
<%			}%>
	</table>
	<%}
	else
	{	%>
		<p>No pages exist.</p>
<%	} %>
</asp:Content>